package com.swing.gui.pages;

import com.swing.assets.Itool;
import com.swing.gui.APP;

import javax.swing.*;
import java.awt.*;

/**
 * 单例模式：饥饿模式
 */
public class Index extends JPanel {

    private static volatile Index index = new Index() {
        @Override
        public void paint(Graphics g) {
            super.paint(g);
            Graphics2D g2 = (Graphics2D) g;
            try{
                g2.setStroke(new BasicStroke(10.0f));
                g2.drawLine(0, 0, 0, 0);
                g2.drawLine(100,100,100,100);
                g2.drawLine(200,200,200,200);
                g2.drawLine(300,200,200,200);
                g2.drawLine(400,200,200,200);

            }catch (Exception e){
                // ignore
            }

        }

    };

    private Index() {
    }

    public static Index get() {
        try {
            System.out.println("加载基本属性……" + System.currentTimeMillis());
            index.setBackground(new Color(82, 114, 148));
            index.setLayout(null);
        } catch (Exception e) {
            // ignore
        }
        return index;
    }


    public static void main(String[] args) {
        APP.init().setContentPane(Index.get());
    }

}
